package practice_02;

import java.util.Random;

public class Role {
    private String name; //角色名
    private int Hp; //血量
    private int attack; //基础伤害
    private int magic = 0; //能量值
    private int magicIncrement; //能量积攒率
    private Skills role_skills;

    public Skills getRole_skills() {
        return role_skills;
    }

    public Role(String name, int hp, int attack, int magicIncrement) {
        this.name = name;
        this.Hp = hp;
        this.attack = attack;
        this.magicIncrement = magicIncrement;
        this.role_skills = new Skills(name, attack);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getHp() {
        return Hp;
    }

    public void setHp(int hp) {
        Hp = hp;
    }

    public int getAttack() {
        return attack;
    }

    public void setAttack(int attack) {
        this.attack = attack;
    }

    public int getMagic() {
        return magic;
    }

    public void setMagic(int magic) {
        this.magic = magic;
    }

    public int getMagicIncrement() {
        return magicIncrement;
    }

    public void setMagicIncrement(int magicIncrement) {
        this.magicIncrement = magicIncrement;
    }

    public void attack(Role role) throws InterruptedException {
        int skill_attack = this.role_skills.getSkills()[0].getSkill_attack();
        role.setHp(role.getHp() - skill_attack);
        System.out.println(this.getName() + "使用技能" + this.getRole_skills().getSkills()[0].getSkill_name() + " " +
                this.getRole_skills().getSkills()[0].getSkill_intro() + " " + "对目标" + role.getName() + " 造成 " + skill_attack +
                "点伤害");
        if (role.getHp() <= 0) {
            role.setHp(0);
        }
        Thread.sleep(600);
        System.out.println(this.getName() + "剩余HP:" + this.getHp() + "\t\t\t" + role.getName() + "剩余HP:" + role.getHp() + "...");
    }
}
